package com.xpp.yanpicturebackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import io.swagger.models.auth.In;
import lombok.Getter;

/**
 * 图片状态枚举
 */
@Getter
public enum PictureReviewStatusEnum {
    REVIEWING("待审核", 0),
    PASS("通过", 1),
    REJECT("拒绝", 2);

    private final String text;
    private final Integer value;

    PictureReviewStatusEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value 枚举的 value 值
     * @return 枚举值
     */
    public static PictureReviewStatusEnum getEnumByValue(Integer value) {
        if (ObjUtil.isNull(value)) {
            return null;
        }
        for (PictureReviewStatusEnum pictureRoleEnum : PictureReviewStatusEnum.values()) {
            if (pictureRoleEnum.value.equals(value)) {
                return pictureRoleEnum;
            }
        }
        return null;
    }
}
